/**
 * Copyright:Copyright(c)2014-2017
 * Company:厦门市易致达物联网科技有限公司
 * @version 1.0
 */
package shop.controller.front.fileload;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import shop.core.FrontBaseController;
import shop.core.Services;
import shop.core.common.bean.JSONResult;
import shop.services.front.fileload.FileloadService;
import shop.services.front.fileload.bean.Fileload;

import javax.annotation.Resource;
import java.util.List;

/**   
 * @类名称：FileloadController
 * @创建人：Wzl
 * @创建时间：2018-05-09 下午17:27:06      
 * @版本号：1.0
 * @描述：     
 */
@Controller
@RequestMapping("/front/fileload")
public class FileloadController extends FrontBaseController<Fileload> {
    @Resource
    private FileloadService fileloadService;
    @Override
    public Services<Fileload> getService() {
        return fileloadService;
    }

    /**
     * 更新下载次数
     *
     * @return jsonResult
     * @throws Exception
     */
    @RequestMapping(value = "/updateFileLoad", method = RequestMethod.POST)
    @ResponseBody
    public JSONResult updateFileLoad(Fileload fileload) throws Exception {
        JSONResult jsonResult = new JSONResult();
        fileload.setLoadAmount(fileload.getLoadAmount()+1);
        fileloadService.update(fileload);
        return jsonResult;
    }
}
